package com.ruoyi.service.impl;

import com.ruoyi.domain.Ability_APIInfor;
import com.ruoyi.domain.Ability_APIRequestInfor;
import com.ruoyi.domain.Ability_APIResponseInfor;
import com.ruoyi.domain.Ability_IndexAPIInfor;
import com.ruoyi.mapper.Ability_IndexAPIInforMapper;
import com.ruoyi.service.Ability_IndexAPIService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service("Ability_IndexAPIServiceImpl")
public class Ability_IndexAPIServiceImpl implements Ability_IndexAPIService {
    @Autowired
    Ability_IndexAPIInforMapper ability_IndexAPIInforMapper;
    @Override
    public List<Ability_IndexAPIInfor> selectAbility_IndexAPIInforById(Integer id) {
        List<Ability_IndexAPIInfor> ability_IndexAPIInforLIST = new ArrayList<>() ;

        List<Ability_APIInfor> api = ability_IndexAPIInforMapper.selectAbility_APIInforById(id);

        for (Ability_APIInfor a:api) {
            Ability_IndexAPIInfor ability_indexAPIInfor = new Ability_IndexAPIInfor();
            ability_indexAPIInfor.setApi(a);
            List<Ability_APIRequestInfor> request = ability_IndexAPIInforMapper.selectAbility_APIRequestInforById(a.getId());
            List<Ability_APIResponseInfor> response = ability_IndexAPIInforMapper.selectAbility_APIResponseInforById(a.getId());
            ability_indexAPIInfor.setRequest(request);
            ability_indexAPIInfor.setResponse(response);
            ability_IndexAPIInforLIST.add(ability_indexAPIInfor);
        }


        return ability_IndexAPIInforLIST;
    }

    @Override
    public List<Ability_APIInfor> selectAbility_APIInforById(Integer id) {
        return null;
    }

    @Override
    public List<Ability_APIRequestInfor> selectAbility_APIRequestInforById(Integer id) {
        return null;
    }

    @Override
    public List<Ability_APIResponseInfor> selectAbility_APIResponseInforById(Integer id) {
        return null;
    }
}
